<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>超市订单管理系统</title>
<link type="text/css" rel="stylesheet" href="../css/style.css" />
<link type="text/css" rel="stylesheet" href="../css/public.css" />
</head>
<body>
	<!--头部-->
	<header class="publicHeader">
		<h1>超市订单管理系统</h1>
		<div class="publicHeaderR">
			<p>
				<span>下午好！</span><span style="color: #fff21b"> 用戶名</span> , 欢迎你！
			</p>
			<a href="#">退出</a>
		</div>
	</header>
	<!--时间-->
	<section class="publicTime">
		<span id="time">2015年1月1日 11:11 星期一</span> <a href="#">温馨提示：为了能正常浏览，请使用高版本浏览器！（IE10+）</a>
	</section>
	<!--主体内容-->
	<section class="publicMian ">
		<div class="left">
			<h2 class="leftH2">
				<span class="span1"></span>功能列表 <span></span>
			</h2>
			<nav>
				<ul class="list">
					<li><a href="user_list.html">用户管理</a></li>
					<li><a href="#">供应商管理</a></li>
					<li><a href="#">订单管理</a></li>
					<li><a href="#">密码修改</a></li>
					<li><a href="#">退出系统</a></li>
				</ul>
			</nav>
		</div>
		<div class="right">
			<div class="location">
				<strong>你现在所在的位置是:</strong>
				<span>用户管理页面 &gt;&gt; 用户详情页面</span>
			</div>
			<div class="providerAdd">
				<div>
					<label for="headImg">头像：</label>
					<img id="headImg" height="100px"/>
					<span id="imgInfo"></span>
				</div>
				<div>
					<label for="usercode">用户编码：</label>
					<span id="usercode"></span>
				</div>
				<div>
					<label for="username">用户名称：</label>
					<span id="username"></span>
				</div>
				<div>
					<label>性别：</label>
					<span id="gender"></span>
				</div>
				<div>
					<label for="birthday">生日：</label>
					<span id="birthday"></span>
				</div>
				<div>
					<label for="age">年龄：</label>
					<span id="age"></span>
				</div>
				<div>
					<label for="phone">手机号码：</label>
					<span id="phone"></span>
				</div>
				<div>
					<label for="address">地址：</label>
					<span id="address"></span>
				</div>
			</div>
		</div>
	</section>

	<footer class="footer"> 版权归程龙 </footer>
	<script src="../js/time.js"></script>
	<script src="../js/jquery-3.5.1.js"></script>
	<script>
		//加载用户数据
		loadData_user();

		function loadData_user(){
			//获取页面传递的id
			var href = location.href;
			var id = href.substring(href.lastIndexOf("=")+1);

			$.ajax({
				url:"../user/getUserById/"+id,
				dataType:"json",
				success:function(result){
					//渲染数据
					renderDate(result);
				},
				error:function(jqxhr){
					alert("请求错误："+jqxhr.status);
				}
			});
		}

		function renderDate(user){
			if(user.headImgName != null){
				$("#headImg").attr("src","../upload/"+user.headImgName);
			}else{
				$("#headImg").remove();
				$("#imgInfo").text("未上传");
			}
			$("#usercode").text(user.usercode);
			$("#username").text(user.username);
			$("#gender").text(user.gender);
			$("#birthday").text(user.birthday);
			$("#age").text(user.age);
			$("#phone").text(user.phone);
			$("#address").text(user.address);
		}
	</script>
</body>
</html>